package net.lainiao.zhihu.reptitle;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Created by Administrator on 2016/1/14.
 */
public class NetCommon {
    /**
     * 获取本机IP
     * @return
     * @throws UnknownHostException
     */
    public static String getLocalIP(){
        InetAddress addr = null;
        try {
            addr = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        String IP=addr.getHostAddress().toString();//获得本机IP
        return IP;
    }
}
